<template>
  <div class="app">
    <h1 class="title">Vue路由尝试</h1>
    <!-- 导航区 -->
    <div class="navigate">
      <RouterLink replace to="/home" active-class="active">首页</RouterLink>
      <RouterLink :to="{ name: 'xinwen' }" active-class="active">新闻</RouterLink>
      <RouterLink :to="{ path: '/learn' }" active-class="active">基本语法学习</RouterLink>
      <RouterLink :to="{ path: '/pinia' }" active-class="active">Pinia学习</RouterLink>
      <RouterLink :to="{ path: '/other' }" active-class="active">其他API</RouterLink>
    </div>
    <div class="main-content">
      <RouterView />
    </div>
  </div>
</template>

<script lang="ts" setup name="App">
import { RouterView, RouterLink } from 'vue-router';
</script>

<style>
.title {
  text-align: center;
  word-spacing: 5px;
  margin: 30px 0;
  height: 70px;
  line-height: 70px;
  background-image: linear-gradient(45deg, gray, white);
  border-radius: 10px;
  box-shadow: 0 0 10px;
  font-size: 30px;
}

.navigate {
  display: flex;
  /* flex-direction: column; */
  justify-content: space-around;
}

.navigate a {
  display: block;
  text-align: center;
  width: 150px;
  height: 40px;
  line-height: 40px;
  border-radius: 10px;
  background-color: gray;
  text-decoration: none;
  color: white;
  font-size: 18px;
  letter-spacing: 5px;
}

.main-content {
  margin: 0 auto;
  margin-top: 30px;
  border-radius: 10px;
  width: 95%;
  border: 1px solid;
}

.navigate a.active {
  background-color: goldenrod;
}
</style>